package cn.edu.scau.cmi.duke.comprehensive;

import java.util.Scanner;

import cn.edu.scau.cmi.duke.abstractFactory.domainAbstractClass.Meat;
import cn.edu.scau.cmi.duke.abstractFactory.factory.AbstractFactory;
import cn.edu.scau.cmi.duke.abstractFactory.factory.AonongFactory;
import cn.edu.scau.cmi.duke.abstractFactory.factory.TianbangFactory;
import cn.edu.scau.cmi.duke.abstractFactory.factory.WensFactory;



public class AbstractFactoryController {
   public static void start() {
		//(1) 选择品牌
		System.out.println("Please select which brand you want to buy: wens, tianbang or aonong???");
		Scanner scanner = new Scanner(System.in);  
		String brandKind = scanner.next();  
		AbstractFactory factory=null;
		switch(brandKind){
		case "wens": factory=new WensFactory();break;
		case "tianbang": factory=new TianbangFactory();break;
		case "aonong": factory=new AonongFactory();break;
		default:System.out.println("sorry, your input is not correct");
		
		}
		
//		（2）选择产品
		
		System.out.println("Please select which product you want to buy: pork, beef or chicken???");
//		Scanner scanner = new Scanner(System.in);  
		String meatType = scanner.next();  
		Meat meat=null;
		switch(meatType) {
		case "pork": meat=factory.createPork();break;
		case "beef": meat=factory.createBeef();break;
		case "chicken": meat=factory.createChicken();break;
		default:System.out.println("sorry, your input is not correct");
		
		}
		if(meat!=null) {
			meat.cook();;
		}
		
		
//		
//		// （1）获取工厂
//		
//		AbstractFactory factory = AbstractFactory.getFactory("apple");
//
//		// (2)获取对象
//		Pad product = factory.createPad();
////		（3）对象执行功能
//		product.play();

	
   }
}
